.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
.stack 200
.data
__error_resta db "RESULTADO NEGATIVO EN RESTA", 0
__error_overflow db "OVERFLOW EN PRODUCTO", 0
__error_division db "ERROR EN DIVISION", 0
__error db "ERROR", 0
_0ul dd 0
_ASIG1MAL db "ASIG 1 MAL", 0
_4ui dw 4
_ASIG2BIEN db "ASIG 2 BIEN", 0
_1ul dd 1
_10ui dw 10
_d dd ?
_c dd ?
_b dw ?
_a dw ?
_ASIG1BIEN db "ASIG 1 BIEN", 0
_3ui dw 3
_ASIG2MAL db "ASIG 2 MAL", 0
.code
start:
MOV bx, _10ui
MOV _a, bx
MOV bx, _4ui
MOV _b, bx
MOV ebx, _1ul
MOV _c, ebx
MOV ebx, 0
MOV bx, _3ui
MOV _d, ebx
MOV ebx, 0
MOV bx, _b
MOV eax, ebx
MUL _d
JO overflow
MOV ebx, eax
MOV eax, ebx
MUL _c
JO overflow
MOV ecx, eax
MOV ecx, _c
ADD ecx, eax
ADD ecx, _c
MOV eax, 0
MOV ax, _a
SUB ecx, eax
JS res_negativo
MOV _d, ecx
MOV ebx, 0
MOV bx, _4ui
MOV eax, _d
CMP eax, ebx
JNE @Label34
invoke MessageBox, NULL, addr _ASIG1BIEN, addr _ASIG1BIEN, MB_OK
JMP @Label36
@Label34:
invoke MessageBox, NULL, addr _ASIG1MAL, addr _ASIG1MAL, MB_OK
@Label36:
MOV ax, _a
MUL _b
JO overflow
MOV bx, ax
MOV ecx, 0
MOV cx, bx
MOV eax, ecx
MUL _c
JO overflow
MOV ecx, eax
MOV ebx, 0
MOV bx, _a
MOV eax, ebx
MUL _d
JO overflow
MOV ebx, eax
SUB ecx, eax
JS res_negativo
MOV _c, ecx
MOV ecx, _c
CMP ecx, _0ul
JNE @Label56
invoke MessageBox, NULL, addr _ASIG2BIEN, addr _ASIG2BIEN, MB_OK
JMP @Label58
@Label56:
invoke MessageBox, NULL, addr _ASIG2MAL, addr _ASIG2MAL, MB_OK
@Label58:
jmp fin
overflow:
invoke MessageBox, NULL, addr __error_overflow, addr __error, MB_OK
invoke ExitProcess, 0
res_negativo:
invoke MessageBox, NULL, addr __error_resta, addr __error, MB_OK
invoke ExitProcess, 0
division:
invoke MessageBox, NULL, addr __error_division, addr __error, MB_OK
invoke ExitProcess, 0
fin:
invoke ExitProcess, 0
end start